package org.java.item;

import org.apache.http.HttpHost;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestHighLevelClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author WHQ
 * @version 1.0
 * @date 2022-3-8 0008 下午 3:46
 */
@Configuration
public class ElasticSearchConfig {
    /**
     * 构建对象
     * @return
     */
    @Bean
    public RestHighLevelClient getRestHighLevelClient(){
        RestHighLevelClient restHighLevelClient = new RestHighLevelClient(
                RestClient.builder(
                        new HttpHost("localhost",9200,"http")
                )
        );
        return  restHighLevelClient;
    }
}
